<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // 
    function richTextFormat(value) {
      // value = value.replace(/<\/?[^>]*>/g,'')
      value = value.replace(/<\/?.+?>/g, '')
      value = value.replace(/\s+/g, '')  // 任何空白字符替换为空
      if (value.length > 10) {
        return value.slice(0, 10) + "...";
      }
      return value;
    }

    let value="d   saj  asdmasklmdklasnmdklpasmkdadsa"
    let val1=richTextFormat(value)
    console.log(val1);
  </script>
</body>

</html>